package org.eenie.appseed.ui.compose

import android.content.res.Configuration
import android.graphics.BitmapFactory
import androidx.compose.runtime.Composable
import androidx.compose.ui.tooling.preview.Preview
import androidx.activity.compose.setContent
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.systemBarsPadding
import androidx.compose.foundation.layout.wrapContentHeight
import androidx.compose.material.Button
import androidx.compose.material.Scaffold
import androidx.compose.material.Text
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.ImageBitmap
import androidx.compose.ui.res.imageResource
import androidx.compose.ui.unit.dp
import org.eenie.appseed.R
import org.eenie.core.base.compose.BaseComposeActivity


class ComposeDemoActivity : BaseComposeActivity() {

    override fun initUI() {
        setContent {
            RenderUI()
        }
    }


    @Preview(
        device = "id:pixel_3a_xl", showSystemUi = true, showBackground = true,
        uiMode = Configuration.UI_MODE_NIGHT_NO or Configuration.UI_MODE_TYPE_NORMAL,
        name = "关于我们"
    )
    @Composable
    fun RenderUI() {

        val name = "name"
        val version = "1.0.0"

        Column(
            modifier = Modifier
                .fillMaxWidth()
                .wrapContentHeight(Alignment.Top)
        ) {
            Box(
                modifier = Modifier
                    .background(Color.Red)
                    .fillMaxWidth()
                    .align(Alignment.CenterHorizontally)
                    .wrapContentHeight(Alignment.CenterVertically)

            ) {
                Column {
                    Text(text = name)
                    Text(text =version)
                }
            }

        }
    }
}